package com.nbicc.util;

import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName: JsonUtils
 * @Description:
 * @Author: zyd
 * @Date: 2021/4/16 9:42
 */
@Component
public class JsonUtils<T> {

    private Integer code;
    private Integer count;
    private List<T> data;
    private String msg;

    public JsonUtils getJson(int code, Integer count, List<T> data, String msg){
        return new JsonUtils(code,count,data,msg);
    }
    public JsonUtils getJsonData(List<T> data){
        return new JsonUtils(100,200,data,"成功");
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public JsonUtils() {
    }

    public JsonUtils(Integer code, Integer count, List<T> data, String msg) {
        this.code = code;
        this.count = count;
        this.data = data;
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "JsonUtils{" +
                "code=" + code +
                ", count=" + count +
                ", data=" + data +
                ", msg='" + msg + '\'' +
                '}';
    }
}
